// stores/auth.ts
import { defineStore } from 'pinia';

export const useAuthStore = defineStore('auth', {
    state: () => ({
        isAuthenticated: false, // 假设这个是存储登录状态的字段
        user: null,
    }),
    actions: {
        login(user: any) {
            this.isAuthenticated = true;
            this.user = user;
        },
        logout() {
            this.isAuthenticated = false;
            this.user = null;
        },
    },
    // 添加持久化配置
    persist: true,
});
